<div class="row m-n">
    <div class="crumbs-bar">
        <div yb-crumbs></div>
    </div>
    <div tabset type="tab">
        <div tab heading="设置零件价格" active="activeFlag[0]">
            <div class="row wrapper-y-sm">
                <div class="search-bar wrapper-none pull-left" style="width: 45%;">
                    <div class="normal-search clearfix">
                        <label class="control-label"><span translate>零件编号</span>：</label>
                        <input type="text" class="form-control m-r-sm" ng-model="condition.materialsNos"
                            translate translate-attr-placeholder="零件编号">
                        <label class="control-label"><span translate>价格方案</span>：</label>
                        <select ng-model="condition.priceScheme" class="form-control m-r-sm"  ng-change="search(1)"
                                ng-options="item.id as item.name for item in priceSchemeList">
                            <option value="" translate>所有价格方案</option>
                        </select>
                        <span class="btn btn-primary" ng-click="search(1)" translate>搜索</span>
                    </div>
                </div>
                <div class="search-bar wrapper-none pull-left" style="width: 55%;">
                    <div class="btn-group m-l-xs pull-right">
                        <button type="button" class="btn btn-default base-color" ng-click="search()" translate translate-attr-title="刷新">
                            <i class="yb-icon ico-refresh"></i>
                        </button>
                        <div class="btn btn-default base-color">
                            <i class="yb-icon ico-import-o"></i>
                            <ul class="more-tool">
                                <button class="btn" ng-click="importData()">
                                    <i class="yb-icon ico-import-o"></i>
                                    <span translate>导入</span>
                                </button>
                            </ul>
                        </div>
                        <div class="btn btn-default base-color" ng-show="!!btnPermission.priceSchemeSetMaterielExport">
                            <div translate translate-attr-title="导出" yb-download download-url="exportParam.allUrl" download-param="condition" download-duration="3">
                                <i class="yb-icon ico-export-o"></i>
                            </div>
                        </div>
                    </div>
                    <button class="btn-advance pull-right m-l-xs" ng-click="switchToolbar('AdvanceSearch')" translate-attr-title="高级搜索" translate="高级搜索more"></button>
                    <button class="btn-advance pull-right m-l-xs" style="width:80px" ng-if="btnPermission.priceSchemeRemoveCache" ng-click="removeCache()" translate>清除导出缓存</button>
                    <div class="pull-right m-r-sm"  title="{{!btnPermission.setMaterielPriceshowCostPrice?('无权限执行此操作'|translate):''}}" style="margin-top: 4px;">
                        <label class="font-12 m-r-xs"><span translate>显示成本价</span>:</label>
                        <toggle ng-model="costPriceShow" yb-click="showCostClick()" yb-disabled="!btnPermission.setMaterielPriceshowCostPrice"></toggle>
                    </div>
                    <div class="pull-right m-r-sm" title="{{!btnPermission.hideUnit?('无权限执行此操作'|translate):''}}" style="margin-top: 4px;">
                        <label class="font-12 m-r-xs"><span translate>隐藏单位</span>:</label>
                        <toggle ng-model="unitHide" yb-disabled="!btnPermission.hideUnit"></toggle>
                    </div>
                    <div class="pull-right m-r-sm" style="margin-top: 4px;">
                        <label class="font-12 m-r-xs"><span translate>展示无效价格</span>:</label>
                        <toggle ng-model="unablePriceShow" yb-click="toggleUnablePrice(unablePriceShow)"></toggle>
                    </div>
                </div>
            </div>
            <div yb-advance-search show-toolbar="toolbarConfig.showAdvanceSearch" search-data="search(1)"
                 reset-data="reset()">
                <div class="advance-search m-t-sm">
                    <div class="form-group clearfix">
                        <label class="control-label"><span translate>零件编号</span>：</label>
                        <textarea ng-model="condition.materialsNos" class="form-control" translate translate-attr-placeholder="逗号分隔或者换行分隔" >
                        </textarea>
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label"><span translate>零件分类</span>：</label>
                        <div ng-model="condition" materiel-class-selector clean-icon="true" class="lh-12-16"></div>
                    </div>
                </div>
            </div>
            <div class="main-area d-b-60">
                <div yb-table-fixed class="table-fixed-wrap">
                    <div class="th-scroll-x">
                        <table class="table-fixed border-none" width="{{tbConf.scrollWidth}}">
                            <thead>
                            <tr>
                                <th ng-repeat="itemCol in tbConf.tableCol track by $index" width="{{itemCol.width}}"
                                    ng-click="toSort(tbConf.tableCol, $index)"
                                    ng-show="!!itemCol.isShow && !itemCol.isFixed">
                                    <div yb-thead-operate ng-model="itemCol" target-width="tbConf.scrollWidth"></div>
                                </th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="dataList.length > 0">
                        <table class="table-fixed border-none" width="{{tbConf.scrollWidth}}">
                            <tbody>
                            <tr ng-repeat="item in dataList track by $index"
                                ng-class="{'row-selected': $index === markInfo.cueRow}" ng-click="selectRow($index)">
                                <td class="spill-dots" ng-repeat="itemCol in tbConf.tableCol track by $index"
                                    width="{{itemCol.width}}"
                                    ng-show="!!itemCol.isShow && itemCol.type !== 'designationPrice' && itemCol.type !== 'discountPrice'"
                                    title="{{item[itemCol.dataField]}}">
                                    {{item[itemCol.dataField]}}
                                </td>

                                <td class="spill-dots" ng-repeat="itemCol in tbConf.tableCol track by $index"
                                    width="{{itemCol.width}}"
                                    ng-show="!!itemCol.isShow && itemCol.type === 'designationPrice'">

                                    <ul class="price-scheme-ul">
                                        <li ng-repeat="priceScheme in item.fixedPrice track by $index"
                                            ng-show="!condition.priceScheme || (!!condition.priceScheme && condition.priceScheme === priceScheme.id)">
                                            <span class="price-scheme-s spill-dots" title="{{priceScheme.name}}">{{priceScheme.name}}</span>：
                                            <input yb-number-input class="price-scheme-txt" type="text"
                                                   ng-model="priceScheme.price" disable-decimal="false"
                                                   decimal-places="2" max="9999999.99"
                                                   ng-change="selectScheme()"> 
                                            <span ng-if="!unitHide && !isJCHK" translate>元</span>
                                            <span class="price-scheme-s spill-dots" title="{{priceScheme.currency}}">{{priceScheme.currency}}</span>       
                                        </li>
                                    </ul>
                                </td>

                                <td class="spill-dots" ng-repeat="itemCol in tbConf.tableCol track by $index"
                                    width="{{itemCol.width}}"
                                    ng-show="!!itemCol.isShow && itemCol.type === 'discountPrice'">
                                    <ul class="price-scheme-ul">
                                        <li ng-repeat="priceScheme in item.ratePrice track by $index"
                                            ng-show="!condition.priceScheme || (!!condition.priceScheme && condition.priceScheme === priceScheme.id)">
                                            <div yb-check-box yb-checked="priceScheme.checked" yb-click="selectScheme()" yb-disabled="priceScheme.allMaterialFlag"
                                                 yb-check-name="{{priceScheme.name}}"></div> <span ng-if="isJCHK && priceScheme.discountPrice">:</span>
                                             <input type="text" class="price-scheme-txt" disabled ng-model="priceScheme.discountPrice" ng-if="isJCHK">    
                                             <span class="price-scheme-s spill-dots" title="{{priceScheme.currency}}">{{priceScheme.currency}}</span> 
                                        </li>
                                    </ul>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="dataList.length === 0" translate>暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area save-bar text-center wrapper-y-sm clearfix">
                <button class="btn btn-primary" ng-click="saveData()"
                        ng-disabled="!!btnEnabled || !btnPermission.priceSchemeSetMateriel" 
                        translate translate-attr-title="{{!btnPermission.priceSchemeSetMateriel?'无权限执行此操作':''}}">保存</button>
                <div yb-page-info ng-model="pageInfo" yb-refresh="search()"></div>
            </div>
        </div>
    </div>
</div>